#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QMenuBar* menuBar = this->menuBar();

    QMenu* menu1 = new QMenu("文件(&F)");
    menuBar->addMenu(menu1);

    QMenu* menu2 = new QMenu("编辑(&I)");
    menuBar->addMenu(menu2);
    QAction* action1 = new QAction("保存(&S)");
    action1->setIcon(QIcon(":/save.png"));
    QAction* action2 = new QAction("打开(&O)");
    action2->setIcon(QIcon(":/open.png"));
    menu1->addAction(action1);
    menu1->addAction(action2);
    connect(action1,&QAction::triggered,this,&MainWindow::handle1);
    connect(action2,&QAction::triggered,this,&MainWindow::handle2);
}

MainWindow::~MainWindow()
{
    delete ui;
}
void MainWindow::handle1()
{
    qDebug()<<"保存文件成功";
}

void MainWindow::handle2()
{
    qDebug()<<"打开文件成功";
}

